#ifndef WEBVIEW_H
#define WEBVIEW_H

#include <QWidget>
#include <QWebView>
#include <QMainWindow>
#include <QPoint>
#include <QMouseEvent>

#include "browsercontrol.h"
#include "mainwindow.h"

namespace Ui {
class WebView;
}

class WebView : public QWebView
{
    Q_OBJECT

public:
    explicit WebView(QWidget *parent = 0);
    ~WebView();

    void setMainWindow(MainWindow *);

protected:
    MainWindow *mainWindow;
    BrowserControl* browserControl;
    bool eventFilter(QObject *, QEvent *);

protected slots:
    void populateJavaScriptWindowObject();
    void openLinkSlot(QUrl);

private:
    Ui::WebView *ui;
    QPoint mainPosition;
    QPoint pressPosition;
    bool isPress;
    void mousePressEvent(QMouseEvent *);
    void mouseReleaseEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);
};

#endif // WEBVIEW_H
